﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ace_pso.Utility
{
    /// <summary>
    /// 粒子实体类，保存一个粒子相关的信息
    /// </summary>
    public class Particle
    {
        public double[,] Velocity { get; set; }
        public double[,] Position { get; set; }//Z_ts
        public double Fitness { get; set; }

        double[,] pBestPosition;
        public double[,] PBestPosition
        {
            get
            {
                if (pBestPosition == null)
                    pBestPosition = new double[3, 10];
                return pBestPosition;
            }
            set
            {
                pBestPosition = value;
            }
        }

        private List<KeyValuePair<int, double>> pBestProfitHis;
        public List<KeyValuePair<int, double>> PBestProfitHis//记录pBest的历史
        {
            get
            {
                if (pBestProfitHis == null)
                    pBestProfitHis = new List<KeyValuePair<int, double>>();
                return pBestProfitHis;
            }
            set
            {
                pBestProfitHis = value;
            }
        }

        private List<KeyValuePair<int, double>> pBestRiskHis;
        public List<KeyValuePair<int, double>> PBestRiskHis //记录pBest的历史
        {
            get
            {
                if (pBestRiskHis == null)
                    pBestRiskHis = new List<KeyValuePair<int, double>>();
                return pBestRiskHis;
            }
            set
            {
                pBestRiskHis = value;
            }
        }
        public double PBestFitness { get; set; }
        public double PBestProfit { get; set; }
        public double PBestRisk { get; set; }

        public double Profit { get; set; }
        public double Risk { get; set; }


    }
}
